export default {
	/* Mon May 16 2016 18:48:34 GMT+0800 (中国标准时间) 转换为 2016-05-16 */
	timeConversionNow(str) {
		str = str.toString().replace(/ GMT.+$/, ''); // Or str = str.substring(0, 24)
		var d = new Date(str);
		var a = [d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()];
		for (var i = 0, len = a.length; i < len; i++) {
			if (a[i] < 10) {
				a[i] = '0' + a[i];
			}
		}
		return a[0] + '-' + a[1] + '-' + a[2] + ' ' + a[3] + ':' + a[4] + ':' + a[5];
	},
	// 2020-11-27T02:58:41.000000Z转换成YYYY-MM-DD hh:mm:ss
	timeChange(UTCDateString) {
		if (!UTCDateString) {return '-';}
		function formatFunc(str) {return str > 9 ? str : '0' + str}
		var date2 = new Date(UTCDateString);
		var year = date2.getFullYear();
		var mon = formatFunc(date2.getMonth() + 1);
		var day = formatFunc(date2.getDate());
		var hour = date2.getHours();
		hour = hour >= 12 ? hour - 12 : hour; // 12小时制
		hour = formatFunc(hour);
		var min = formatFunc(date2.getMinutes());
		var sec = formatFunc(date2.getSeconds());
		var dateStr = year + '-' + mon + '-' + day + ' ' + hour + ':' + min + ':' + sec;
		return dateStr;
	}

}
